import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
/* pinia 持久化插件 */
import piniaPluginPersist from 'pinia-plugin-persist'
/* 路由 */
import router from './router'
/* Echars */
import echarts from './utils/echarts';

/* ElementPlus */
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ELIcons from '@element-plus/icons-vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
/* ViewPlus组件库 */
import ViewUIPlus from 'view-ui-plus'
import 'view-ui-plus/dist/styles/viewuiplus.css'
/* ArcoVue组件库 */
import ArcoVue from '@arco-design/web-vue';
import '@arco-design/web-vue/dist/arco.css';

import './assets/main.css'
const store = createPinia()
store.use(piniaPluginPersist)


const app = createApp(App)

const orderStatus = {
  1: '待支付',
  2: '已支付',
  3: '配货完成',
  4: '出库成功',
  5: '交易成功',
  '-1': '手动关闭',
}
/* 过滤器全局方法 */
// 全局方法
app.config.globalProperties.$filters = {
  orderMap(status) {
    return orderStatus[status] || '未知状态'
  },
}
for (let iconName in ELIcons) {
  app.component(iconName, ELIcons[iconName])
}

app.config.globalProperties.$echarts = echarts
app.use(ElementPlus, {
  locale: zhCn,
})
app.use(store)
app.use(router)
app.use(ElementPlus)
app.use(ViewUIPlus)
app.use(ArcoVue)
app.mount('#app')